#! F:/Python/python.exe
#encoding utf-8
import unittest
from skyservice import SkyPimManager
import sys, urllib2

req = None
fd = urllib2.urlopen('http://localhost:8080', req)
#===============================================================================
# import xmlrpclib, code
# url = 'http://localhost:8080'
# s = xmlrpclib.ServerProxy ( url, allow_none=1 )
# intrep = code.InteractiveConsole ( {'s':s} )
# print s.system.listMethods()
# intrep.interact ( "You can now use the object s to interact with the server.")
#===============================================================================

#author xuhong 
#date 2007-11-8
class TestSkyPimManager(unittest.TestCase):
    skyUserAcounts = 'skyUser10'
    localUserAcounts = '_skyUser1_0'
    endStr = '}\n'
    skyPimMgr = SkyPimManager(skyUserAcounts)
    def setUp(self):
        #print 'begin setUp()\n{\n'
        pass
        #print TestSkyPimManager.endStr
    def tearDown(self):
        #print 'begin tearDown()\n{\n'
        pass
        #print TestSkyPimManager.endStr
    def testgetNext(self):
        print 'begin getNext()\n{\n'
        #TestSkyPimManager.skyPimMgr.getNext(10, 1)
        pass
        print TestSkyPimManager.endStr
    def test1login(self):
        print 'begin login()\n{\n'
        req = urllib2.Request({'Params': 'logIn', 'Name': 'skyUser5'})
        fd = urllib2.urlopen('http://localhost:8080', req)
        while True:
            data += fd.read(2048)
        self.assertEqual(s.service_logIn(TestSkyPimManager.skyUserAcounts,'123456'), TestSkyPimManager.skyUserAcounts)
        print TestSkyPimManager.endStr
    def testsignIn(self):
        print 'begin signIn()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testcheck(self):
        print 'begin check()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testgetCode(self):
        print 'begin getCode()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testfind(self):
        print 'begin find()\n{\n'
        print skyPimMgr.service_find(TestSkyPimManager.skyUserAcounts, 'sky',1, 10, 0)
        #self.assertEqual(s.find(TestSkyPimManager.skyUserAcounts, 1, 10, 0), [])
        print TestSkyPimManager.endStr
    def testdelete(self):
        print 'begin delete()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testadd(self):
        print 'begin add()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testupdate(self):
        print 'begin update()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testsize(self):
        print 'begin size()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testlastModified(self):
        print 'begin lastModified()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testgetInfo(self):
        print 'begin getInfo()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testsetInfo(self):
        print 'begin setInfo()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testincrementFrequency(self):
        print 'begin incrementFrequency()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testbeginExport(self):
        print 'begin beginExport()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testendExport(self):
        print 'begin endExport()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testrollback(self):
        print 'begin rollback()\n{\n'
        pass
        print TestSkyPimManager.endStr
    def testexport(self):
        print 'begin export()\n{\n'
        pass
        print TestSkyPimManager.endStr

if __name__ == "__main__":
    suite = unittest.TestLoader().loadTestsFromTestCase(TestSkyPimManager)
    unittest.TextTestRunner(verbosity=2).run(suite)
#    unittest.main()
    